package com.uatair.common.kafka;

import com.uatair.common.service.DroneDataService;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

//@Component
public class DroneDataListener {

    private final DroneDataService droneDataService;

    public DroneDataListener(DroneDataService droneDataService) {
        this.droneDataService = droneDataService;
    }

    @KafkaListener(
            topics = "${kafka.topic:lianhefeiji-fly-tohenan}",
            groupId = "${kafka.consumer.group:drone-consumer-group}",
            containerFactory = "kafkaListenerContainerFactory"
    )
    public void listen(String message) {
        droneDataService.processFlightRecord(message);
    }
}